#include "EventPoller.h"
#include "Game.h"
#include "GameOverState.h"
#include "PlayState.h"

PlayState::PlayState()
{
	m_background.Load("Images/Main Menu Temp1.png");
	m_player.Load();
	TheEventPoller::Instance()->AddHandler(&m_player);
}

void PlayState::Draw()
{
	m_background.Draw(0, 0, Screen::Instance());
	m_player.Draw();
}

void PlayState::Update()
{
	m_player.Update();
}

void PlayState::OnKeyBoardEvent(const SDL_KeyboardEvent& k)
{
	if(k.keysym.sym == SDLK_g && k.state == SDL_PRESSED)
	{
		TheGame::Instance()->SetGameState(TheGameOverState::Instance());
	}

	if(k.keysym.sym == SDLK_ESCAPE && k.state == SDL_PRESSED)
	{
		exit(0);
	}
}